<?php
FLEA::loadClass('Controller_Base');
class Controller_Manage extends Controller_Base {
	var $_modelForum;
	var $_modelUser;
	var $_modelProduct;
	function Controller_Manage() {
		$this->_modelBlock = & FLEA::getSingleton("Model_Block");
		$this->_modelProduct = & FLEA::getSingleton("Model_Product");		
	}
	function actionCreateBlock() {
		$this->_modelUser = & FLEA::getSingleton("Model_Users");
		$user = $this->_modelUser->findByEmail($_SESSION['jiraa']['email']);
		dump($user);
		$block = array(
			"name"=>"网络技术",
			"firstman"=>"thankwsx"
		);
		$this->_modelBlock->create($block);
		dump($this->_modelBlock->findAll());
	}
	function actionCreateProduct() {
		$post = array(
			"title"=>"1st Post",
			"memo"=>"备注",
			"content"=>"文章内容",
			"fid"=>2
		);
//		$this->_modelPost->create($post);
		dump($this->_modelProduct->findAll());
	}
	function actionListProducts() {
		dump($this->_modelProduct->findAll());
	}
	function actionListForums() {
		$forums = $this->_modelForum->findAll(); 
		echo "<style>* {margin:0;padding:0;}
		.forum{
			margin:0 auto;
			color:#666;
			font-size:14px;
			border:1px dashed #aaa;
			width:100%;
			position:relative;
			min-width:600px;
			width:600px;
		}
	.index_forum_left {
		position:relative;
		float:right;
		top:0;
		display:inline;
		width:100px;
		height:30px;
		min-height:40px;
		background:#fcf0e3;
	}
	.index_forum_right {
		left:0px;
		top:0px;
		position:relative;
		display:inline;
	}
	.index_forumname {
		float:left;
		color:#f3f3f3;
		display:inline;
		padding:2px;
		margin:2 0px;
		background:#205020;
		border-bottom:2px solid #30c030;
	}
	.index_firstman {
		float:left;
		color:#3f8f3f;
		display:inline;
		width:250px;
		padding-left:10px;
		margin:2 0px;
		padding-top:2px;
		padding-bottom:2px;
		border-bottom:2px solid #30c030;
	}
	.index_created {
		float:left;
		position:relative;
		display:inline;
		margin:2 0px;
		padding-top:2px;
		padding-bottom:2px;
		color:#333333;
		border-bottom:2px solid #30c030;
	}
	.index_desc {
		margin:4px;
		width:100%;
		float:left;
	}
	.forum p {
		position:relative;
		width:100%;
		margin:4px;
	}
	</style>";
		foreach($forums as $forum) {
			echo "<div class='forum'><div class='index_forum_left'><img src='".$forum['logo']."' /></div>"."<div class='index_forum_right'><p><span class='index_forumname'>".$forum['forumname']."</span><span class='index_firstman'>".$forum['firstman']."</span><span class='index_created'>".$forum['created']."</span></p><p><span class='index_desc'>".$forum['desc']."</span></p></div></div>";
		}
	}
}
?>